<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('分配集中器选择阀门')" />
</head>

<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="baseConcentratorData-form">
				    <input type="hidden" id="concentratorId" name="concentratorId" th:value="${concentratorId}">
					<div class="select-list">
						<ul>
							<li>
								阀门ID：<input type="text" name="valveId"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
	        
	        <div class="col-sm-12 select-table table-striped">
			    <table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	<th:block th:include="include :: footer" />
	<script th:inline="javascript">
		var prefix = ctx + "module/concentrator/data/authValve";

		$(function() {
			var options = {
		        url: prefix + "/unallocatedList",
		        sortName: "valveId",
		        sortOrder: "asc",
		        modalName: "阀门",
		        showSearch: false,
		        showRefresh: false,
		        showToggle: false,
		        showColumns: false,
		        clickToSelect: true,
		        rememberSelected: true,
		        columns: [{
						field: 'state',
						checkbox: true
					},
					{
						field: 'valveId',
						title: '阀门ID'

					},
					{
						field: 'valveType.typeName',
						title: '阀门型号'
					},
					{
						field: 'installAddress',
						title: '安装地址'
					},
					{
						field: 'installUser',
						title: '安装人',
						sortable: true
					},
					{
						field: 'installTime',
						title: '安装时间',
						sortable: true
					},
					{
						field: 'factory.factoryName',
						title: '厂商名称'
					},
					{
						field: 'factory.factoryCode',
						title: '厂商代码'
					}]
		    };
		    $.table.init(options);
		});
		
		/* 添加用户-选择用户-提交 */
		function submitHandler() {
			var rows = $.table.selectFirstColumns();
			if (rows.length == 0) {
       			$.modal.alertWarning("请至少选择一条记录");
       			return;
       		}
			var data = { "concentratorId": $("#concentratorId").val(), "valveIds": rows.join() };
			$.operate.save(prefix + "/selectAll", data);
		}
	</script>
</body>
</html>